home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15299 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: fido.asd.sgi.com!news
  2. From: austern@isolde.mti.sgi.com (Matt Austern)
  3. Newsgroups: comp.lang.java,comp.lang.c++,comp.lang.smalltalk
  4. Subject: Re: Will Java kill C++?
  5. Date: 04 Apr 1996 18:27:05 GMT
  6. Organization: SGI
  7. Message-ID: <AUSTERN.96Apr4102705@isolde.mti.sgi.com>
  8. References: <Dp5J6n.F2K@news.hawaii.edu> <4jno9v$css@newsbf02.news.aol.com>
  9.     <Dp7DKD.1nt@news.hawaii.edu> <4jr7gf$dc6@nyheter.chalmers.se>
  10.     <4jrlou$l8a@netope.harvard.edu> <ROGOFF.96Apr2130820@sccm.Stanford.EDU>
  11.     <3162FD33.61F7@uh.edu>
  12. Reply-To: austern@mti.sgi.com
  13. NNTP-Posting-Host: isolde.mti.sgi.com
  14. In-reply-to: Jeff M Younker's message of Wed, 03 Apr 1996 16:35:31 -0600
  15.  
  16. In article <3162FD33.61F7@uh.edu> Jeff M Younker <jeff@uh.edu> writes:
  17.  
  18. > Value types are really cool from a conceptual point of view, but
  19. > I am not so sure that they are necessary to achieve fast numerical
  20. > code.  If my understanding is correct, Fortran 77 (the premiere
  21. > language of high speed code) treats integers, floats and complex
  22. > numbers as references.  I have yet to hear anyone complain about
  23. > the speed of Fortran code.
  24.  
  25. Yes and no.  In Fortran 77, all objects are what C calls "automatic"
  26. or "static" [*], and what Eiffel calls "expanded".  That is, if x and
  27. y are of type REAL*8, then the expression x = y assigns the value of y
  28. to x.  Variables are allocated on the stack or in static storage,
  29. rather than being dynamically allocated, and you're manipulating
  30. values rather than not pointers.  In other words, all Fortran 77
  31. objects are value types.
  32.  
  33. What is true is that parameters in Fortran 77 subroutines are passed
  34. by reference rather than by value: you can, for example, modify the
  35. values of the arguments you're passed.  Fortran 77 imposes very strong
  36. constraints, though (such as no aliasing or recursion), so the
  37. semantics of Fortran subroutine calls really doesn't have much in
  38. common with an all-pointer language like Java or Smalltalk.
  39.  
  40. ---------------------------
  41.  
  42. [*] One interesting bit of trivia: a lot of people, including a lot of
  43. Fortran programmers, think that the Fortran 77 standard guarantees
  44. that variables are static.  That's false; it just happens that many
  45. implementations do that, and many programmers have written incorrect
  46. code that relies on such behavior.
  47. -- 
  48. Matt Austern
  49. SGI: MTI Compilers Group
  50. austern@isolde.mti.sgi.com
  51.